package cn.iocoder.yudao.module.promotion.api.quickcombination;

import cn.iocoder.yudao.module.promotion.api.quickcombination.dto.QuickCombinationProductRespDTO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.quickcombinationactivity.QuickCombinationActivityDO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.quickcombinationactivity.QuickCombinationProductDO;
import cn.iocoder.yudao.module.promotion.service.combination.CombinationRecordService;
import cn.iocoder.yudao.module.promotion.service.quickcombinationactivity.QuickCombinationActivityService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;

@Service
@Validated
public class QuickCombinationApiImpl implements QuickCombinationApi{

    @Resource
    private QuickCombinationActivityService quickCombinationActivityService;

    @Override
    public QuickCombinationProductRespDTO validateQuickCombination(Long userId, Long activityId, Long skuId, Integer count){
        QuickCombinationProductDO productDO = quickCombinationActivityService.validateQuickCombination(userId, activityId, skuId, count);

        QuickCombinationProductRespDTO respDTO = new QuickCombinationProductRespDTO();
        respDTO.setActivityId(productDO.getActivityId());
        respDTO.setSkuId(productDO.getSkuId());
        respDTO.setSpuId(productDO.getSpuId());
        respDTO.setCombinationPrice(productDO.getCombinationPrice());

        return respDTO;
    }
}
